<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <img src="./1.jpg" alt="" style="opacity: 0.5;">
        <img src="./1.jpg" alt="" style="opacity: 0.5;">
        <img src="./1.jpg" alt="" style="opacity: 0.5;">
        <img src="./1.jpg" alt="" style="opacity: 0.5;">
    </div>
</body>

</html>
<script>
    let img = document.querySelectorAll("img")
    for (var i = 0; i < img.length; i++) {

        img[i].onmouseover = function () {
            for (var j = 0; j < img.length; j++) {
                console.log(img[j]);
                img[j].style.opacity = '0.5'
            }
            this.style.opacity = '1'
        }

    }
</script>